﻿<?php
	define("SERVER","127.0.0.1");
	define("USER","postgres");
	define("PASSWD","admin");
	define('DB_NAME', "videoclubfas");
	define('PORT', "5432");
	define("PDO_DSN","pgsql:host=".SERVER.";port=".PORT.";dbname=".DB_NAME);
	
	define ("SQUELETTE","./views/squelettes/afficheAdmin.php");
	define ("SQUELETTE2","../views/squelettes/afficheAdmin.php");

	function connectToDB(){
	    $db = new PDO("pgsql:host=" . SERVER . ";port= " . PORT . ";dbname=" . DB_NAME,
        	            USER, PASSWD)
        	  or die("Echec de connexion au serveur");
	    $db->exec("SET NAMES 'UTF8'");
	    return $db;
	}
	
	function execQuery($sql){
	    $db = connectToDB();
	    $rq=$db->prepare($sql);
	    $rq->execute();
	    return $rq;
	}
	
	
?>
